package com.dongchen.designpatter.chapter04.simplefactory.sample01;

import lombok.extern.slf4j.Slf4j;

/**
 * @author dongchen
 * @time 2021/9/17
 */
@Slf4j
public class TVFactory {
    public static TV produceTV(String brandName) throws Exception {
        if (brandName.equalsIgnoreCase("Haier")) {
            log.info("Haier is producing !");
            return new HaierTV();
        } else if (brandName.equalsIgnoreCase("Hisence")) {
            log.info("Haier is producing !");
            return new HisenseTV();
        } else {
            throw new Exception("Sorry, There is't the brand TV");
        }
    }
}
